#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/6/21 17:54
# @Author : 闫峰
# @File    : temuListingPirceCleanScheduler.py
from common.setting import ensure_path_sep
from utils.mysqlUtils.db_pool import Database


class TemuListingPirceCleanScheduler:


    def test_temu_listing_pirce_clean_scheduler(self):

        zhcxkj_center_listing_comprehensive_db = Database(ensure_path_sep("\\config\\shopeev2_config.yaml.bak"), "zhcxkj_center_listing_comprehensive")

        index = 0
        while True:
            get_data_sql = f"""
            select id,pf_skc_id,declared_price,currency_type
            from zhcxkj_center_listing_comprehensive.t_temu_listing_product
            where id > %s
            order by id
            limit 1000
            """
            data = zhcxkj_center_listing_comprehensive_db.fetch_all_tuple(get_data_sql,(index,))
            if not len(data):
                break
            index = data[-1][0]
            pf_sku_id_set = set(map(lambda x:x[1],data))

            get_actual_data = f"""
            select id
            from zhcxkj_center_listing_comprehensive.t_temu_listing_sku
            where pf_skc_id in %s
            """
            actual = zhcxkj_center_listing_comprehensive_db.fetch_all_tuple(get_actual_data,(pf_sku_id_set,))



if __name__ == '__main__':
    TemuListingPirceCleanScheduler().test_temu_listing_pirce_clean_scheduler()